package com.itheima.time;

import com.itheima.Main;

import java.time.Duration;
import java.time.Instant;

/**
 * @Author: Ethan Yankang
 * @Program: JavaUtilsDiy
 * @Date: 2024-08-15 20:29
 **/
public class TimeConsuming {
    public static void main(String[] args) throws InterruptedException {
        Instant start = Instant.now();
        System.out.println("start = " + start);
        Instant  end = Instant.now();
        System.out.println("end = " + end);

        // 计算时间差
        Duration duration = Duration.between(now, end);
        System.out.println("Duration (end-now) = " + duration.toMillis() + " milliseconds");
    }
}
